home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_item_fieldlight.cog < prev    next >
Text File  |  1998-02-25  |  2KB  |  103 lines

  1. # Jedi Knight Cog Script
  2. #
  3. # ITEM_FIELDLIGHT.COG
  4. #
  5. # INVENTORY Script - Field Light
  6. #
  7. # [CYW & YB]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10.  
  11.  
  12. symbols
  13.  
  14. thing       player
  15. int         actorFlags
  16.  
  17. message     activated
  18. message     pulse
  19. message     killed
  20.  
  21. sound       lightActivate=activate04.wav
  22. sound       lightDeactivate=deactivate04.wav
  23.  
  24. end
  25.  
  26. # ========================================================================================
  27.  
  28. code
  29.  
  30. activated:
  31.    player = GetSourceRef();
  32.  
  33.    actorFlags = GetActorFlags(player);
  34.  
  35.    if(GetInv(player, 42))
  36.    {
  37.       if(BitTest(actorFlags, 4))
  38.       {
  39.          // Print("Field Light OFF");
  40.          jkPrintUNIString(player, 252);
  41.          ClearActorFlags(player, 4);
  42.          SetInvActivated(player, 42, 0);
  43.          PlaySoundThing(lightDeactivate, player, 1.0, -1, -1, 0x80);
  44.          SetPulse(0);
  45.       }
  46.       else
  47.       {
  48.          if(GetInv(player, 13) > 0)
  49.          {
  50.             // Print("Field Light ON");
  51.             jkPrintUNIString(player, 251);
  52.             SetActorFlags(player,4);
  53.             SetInvActivated(player, 42, 1);
  54.             PlaySoundThing(lightActivate, player, 1.0, -1, -1, 0x80);
  55.             SetPulse(1.5);
  56.          }
  57.          else
  58.          {
  59.             // Print("Field Light out of power");
  60.             PlaySoundThing(lightDeactivate, player, 1.0, -1, -1, 0x80);
  61.             jkPrintUNIString(player, 253);
  62.          }
  63.       }
  64.    }
  65.  
  66.    Return;
  67.  
  68. # ........................................................................................
  69.  
  70. pulse:
  71.    ChangeInv(player, 13, -1);
  72.    if(GetInv(player, 13) == 0)
  73.    {
  74.       // Print("Field Light out of power");
  75.       jkPrintUNIString(player, 253);
  76.       PlaySoundThing(lightDeactivate, player, 1.0, -1, -1, 0x80);
  77.       ClearActorFlags(player, 4);
  78.       SetInvActivated(player, 42, 0);
  79.       SetPulse(0);
  80.    }
  81.  
  82.    Return;
  83.  
  84. # ........................................................................................
  85.  
  86. killed:
  87.    player = GetLocalPlayerThing();
  88.    if(GetSenderRef() != player) Return;
  89.  
  90.    if(IsInvActivated(player, 42) == 1)
  91.    {
  92.       SetPulse(0);
  93.       ClearActorFlags(player, 4);
  94.       SetInvActivated(player, 42, 0);
  95.    }
  96.    Return;
  97.  
  98. end
  99.  
  100.  
  101.  
  102.  
  103.